package com.kun.rental.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kun.rental.entity.CarrentalMaker;
import com.kun.rental.mapper.CarrentalMakerMapper;
import com.kun.rental.service.ICarrentalMakerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kun.rental.utils.Result;
import freemarker.template.utility.StringUtil;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ikun
 * @since 2024-07-04
 */
@Service
public class CarrentalMakerServiceImpl extends ServiceImpl<CarrentalMakerMapper, CarrentalMaker> implements ICarrentalMakerService {




    /**
     * 分页查询
     * @param start
     * @param size
     * @param carrentalMaker
     */
    @Override
    public Page<CarrentalMaker> search(int start, int size, CarrentalMaker carrentalMaker) {
        QueryWrapper<CarrentalMaker> wrapper = new QueryWrapper<>();
        wrapper.orderByAsc("order_letter")
                            .like(StrUtil.isNotEmpty(carrentalMaker.getName()), "name", carrentalMaker.getName());
        Page<CarrentalMaker> page = new Page<>(start, size);
        this.page(page, wrapper);
        return page;
    }


}
